package cz.acies.http.servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cz.acies.data.process.UserProcessor;

public class LoginServlet extends HttpServlet
{
	private static final long serialVersionUID = -6921203750437012513L;

	public LoginServlet() {
		super();
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			PrintWriter out = response.getWriter();
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			
			//System.out.println("LoginServlet.doPost().params: " + params);
			UserProcessor process = new UserProcessor();
			process.setRequest(request); 
			process.execute(request, response);
			
			out.flush();
			out.close();
		} catch (Exception exc) {
			exc.printStackTrace();
		}
	}
}
